<template>
	<el-drawer title="会议详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="发起人">
						<div style="width: 100%;">
							<el-avatar :src="form.avatar" size="small" style="margin-top: 5px;"></el-avatar>
							<span style="position: absolute;margin-left: 15px">{{form.createUserName}}</span>
							<span style="float: right">
								<div>
									<el-icon style="margin-right: 10px;"><el-icon-iphone/></el-icon>{{form.tel}}
								</div>
							</span>
						</div>
					</el-form-item>
					<el-form-item label="会议主题">
						<span style="font-weight: 600;font-size: 16px">{{form.subject}}</span>
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="会议室">
								{{form.roomName}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="主持人">
								{{form.chairUserName}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="开始时间">
								{{form.beginTime}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="结束时间">
								{{form.endTime}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="会议设备">
						<div v-html="form.deviceName"></div>
					</el-form-item>
					<el-form-item label="会议内容">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="会议附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			form: {
				meetingId: '',
				subject: '',
				avatar:'',
				createUserName:'',
				meetingTypeName: '',
				tel: '',
				chairUserName: '',
				notesUser: '',
				roomId: '',
				deviceId: '',
				beginTime: '',
				endTime: '',
				joinCal: '0',
				attachRole: '1',
				userJoin: '',
				deptJoin: '',
				levelJoin: '',
				otherJoin: '',
				content: '',
				roomName: '',
				attachId: '',
				deviceName:'',
			},

			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		async getMeetingDeviceListName(deviceIds)
		{
			var res = await this.$API.office.meeting.getMeetingDeviceListName.get({deviceIds:deviceIds});
			if (res.code == 200) {
				this.form.deviceName = res.redirect;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		//显示
		open(){
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data){
			this.form.meetingId = data.meetingId
			this.form.createUserName = data.createUserName
			this.form.avatar = data.avatar
			this.form.subject = data.subject
			this.form.meetingTypeName = data.meetingTypeName
			this.form.tel = data.tel
			this.form.chairUserName = data.chairUserName
			this.form.notesUser = data.notesUser
			this.form.roomId = data.roomId
			this.form.deviceId = data.deviceId
			this.form.beginTime = data.beginTime
			this.form.endTime = data.endTime
			this.form.content = data.content
			this.form.roomName = data.roomName
			this.form.attachId = data.attachId
			if(data.deviceId!='')
			{
				this.getMeetingDeviceListName(data.deviceId);
			}
		},
    async getMyMeetingById(data)
    {
      let res = await this.$API.office.meeting.getMyMeetingById.get({meetingId:data});
      {
        if(res.code==200)
        {
          this.form.meetingId = res.data.meetingId
          this.form.createUserName = res.data.createUserName
          this.form.avatar = res.data.avatar
          this.form.subject = res.data.subject
          this.form.meetingTypeName = res.data.meetingTypeName
          this.form.tel = res.data.tel
          this.form.chairUserName = res.data.chairUserName
          this.form.notesUser = res.data.notesUser
          this.form.roomId = res.data.roomId
          this.form.deviceId = res.data.deviceId
          this.form.beginTime = res.data.beginTime
          this.form.endTime = res.data.endTime
          this.form.content = res.data.content
          this.form.roomName = res.data.roomName
          this.form.attachId = res.data.attachId
          if(this.form.deviceId!='')
          {
            this.getMeetingDeviceListName(this.form.deviceId);
          }
        }else
        {
          this.$alert(res.message, "提示", {type: 'error'})
        }
      }
    }
	}
}
</script>

<style>
</style>
